﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate.Mapping;

namespace NHibernate.Audit.Cfg
{
    public class DefaultAuditTableConvention : AbstractAuditTableConvention 
    {

        public override string GetAuditTableNameFor(Table table)
        {
            if (table.IsQuoted)
            {
                return string.Format("`{0}_Audit`", table.Name);
            }
            else
            {
                return string.Format("{0}_Audit", table.Name);
            }
        }

        public override string GetAuditTableSchemaFor(Table table)
        {
            return table.GetQuotedSchema();
        }

        public override string GetAuditTableCatalogFor(Table table)
        {
            return table.Catalog;
        }
    }
}
